package com.zzyl.nursing.controller.member;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.zzyl.nursing.dto.SelectDeviceDataListDto;
import com.zzyl.nursing.dto.UserLoginRequestDto;
import com.zzyl.nursing.vo.LoginVo;
import com.zzyl.nursing.vo.SelectDeviceDataListVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.nursing.domain.FamilyMember;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.common.utils.poi.ExcelUtil;
import com.zzyl.common.core.page.TableDataInfo;

/**
 * 老人家属Controller
 * 
 * @author ruoyi
 * @date 2025-05-30
 */
@RestController
@RequestMapping("/member/user")
@Api(tags = "老人家属的接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;
    // 根据 iotId	设备Id(唯一标识) endTime	结束时间 functionId	功能ID startTime	开始时间 查询老人设备上的数据

    @GetMapping("/queryDeviceDataListByDay")
    @ApiOperation("老人家属查询老人佩戴设备的数据")
    public AjaxResult queryDeviceDataListByDay(SelectDeviceDataListDto dto){
        List<SelectDeviceDataListVo>  selectDeviceDataListVos =  familyMemberService.queryDeviceDataListByDay(dto);
        return success(selectDeviceDataListVos);
    }


    // 根据 iotId	设备Id(唯一标识) endTime	结束时间 functionId	功能ID startTime	开始时间 查询老人设备上的数据

    @GetMapping("/queryDeviceDataListByWeek")
    @ApiOperation("老人家属查询老人佩戴设备的数据：按周查询")
    public AjaxResult queryDeviceDataListByWeek(SelectDeviceDataListDto dto){
        List<SelectDeviceDataListVo>  selectDeviceDataListVos =  familyMemberService.queryDeviceDataListByWeek(dto);
        return success(selectDeviceDataListVos);
    }

//     /member/user/login  post


    @ApiOperation(value = "微信家属端的登录接口")
    @PostMapping("/login")
    public AjaxResult login(@RequestBody UserLoginRequestDto dto){

        LoginVo loginVo =  familyMemberService.login(dto);
        return success(loginVo);
    }


}
